import { defineStore } from 'pinia'

export const usePinia1 = defineStore('pinia1', {
  state: () => {
    return {
      num: 1
    }
  },
  getters: {
    dobuleNum (state) {
      return state.num * 2
    }
  },
  actions: {
    add (payload) {
      this.num += payload
    },
    sub (payload) {
      setTimeout(() => {
        this.num -= payload
      }, 1000)
    }
  }
})
